<template>
  <div>
    <el-form label-width="70px" label-position="left">
      <el-form-item label="密码">
        <el-button
          type="text"
          size="medium"
          style="position: relative;top: -2px;"
          @click="onUpdatePasswordClick"
        >修改密码</el-button>
      </el-form-item>
      <el-form-item label="启用账号">
        <enable-status v-model="status" :admin="admin" primaryColor />
      </el-form-item>
    </el-form>

    <password-update-dialog ref="passwordUpdateDialog" />
  </div>
</template>

<script>
import EnableStatus from '../EnableStatus';
import PasswordUpdateDialog from '../PasswordUpdateDialog';

export default {
  components: {
    PasswordUpdateDialog,
    EnableStatus
  },
  data() {
    this.admin = app.admin;
    return {
      status: this.admin.status
    };
  },
  methods: {
    onUpdatePasswordClick() {
      this.$refs.passwordUpdateDialog.open(this.admin);
    },
  },
}
</script>